package com.yidu.main;

import java.io.IOException;
import java.io.InputStream;

import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
import org.junit.Test;

import com.yidu.domain.YwArea;
import com.yidu.domain.YwAudition;

import oracle.net.ns.SessionAtts;



public class AuditionDemo {
	
	static SqlSession session=getSession();
	
	public static SqlSession getSession() {
		String resource = "config/mybatis-config.xml";
		InputStream inputStream=null;
		try {
			inputStream = Resources.getResourceAsStream(resource);
		} catch (IOException e) {
			e.printStackTrace();
		}
		SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(inputStream);
		
		return sqlSessionFactory.openSession();
		
	}
	
	@Test
	public void add() {
		YwAudition ywAudition=new YwAudition();
		ywAudition.setmId("0FC7123FA217409FB2ED6BDB6606BE89");
		ywAudition.setuId("5F4A3D780D69416CB1455234C4C07494");
		session.insert("com.yidu.domain.YwAudition.add",ywAudition);
		session.commit();
	}
}
